package com.loop.inClass;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Demo1<T> {
    //private static T a = new T();
    private T t;
    private List<T> list = new ArrayList<>();

    public T getT() {
        return t;
    }

    public void setT(T t) {
        this.t = t;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public void add(T t){
        list.add(t);
    }

    public T getEle(int index){
        return list.get(index);
    }

    public static<E> void test(E[] t, Integer index1, Integer index2){
        E ele = t[index1];
        t[index1] = t[index2];
        t[index2] = ele;
        System.out.println(Arrays.toString(t));
    }
}
